package com.mccken.annotation.logoperator;

import java.io.Serializable;
import java.lang.reflect.Method;

import org.springframework.aop.support.StaticMethodMatcherPointcut;
import org.springframework.util.CollectionUtils;

/**
 * @program: mccken-collect
 * @description:
 * @author: mccken
 * @create: 2022-01-04 16:14
 **/
public class LogRecordPointcut extends StaticMethodMatcherPointcut implements Serializable {
	
	// LogRecord的解析类
	private LogRecordOperationSource logRecordOperationSource;
	
	@Override
	public boolean matches(Method method, Class<?> targetClass) {
		return !CollectionUtils.isEmpty(logRecordOperationSource.computeLogRecordOperations(method, targetClass));
	}
	
	void setLogRecordOperationSource(LogRecordOperationSource logRecordOperationSource) {
		this.logRecordOperationSource = logRecordOperationSource;
	}
}
